<?php
/*
* Created on 14/09/2008
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
class VOption {
    public $html="";
    public function __construct($variaveis, $tag=''){
        $this->variaveis 	= $variaveis;
        $this->tag		= $tag;
    }
    public function VOption($cr, $id){
            $dados 	= $cr->getResultados();
            foreach ($dados as $linha) {
                    $vl		=$linha["vl"];
                    $opcao 	=$linha["opcao"];
                            if($vl==$id){
                                    $this->html .="<option value='$vl' selected='selected'>$opcao</option>";
                            }else {
                                    $this->html .="<option value='$vl'>$opcao</option>";
                            }
            }
    }
    public function __toString(){
        foreach($this->variaveis as $nomeVar => $param){
            foreach($param as $label => $valor){
                $html .= "<label for='$nomeVar'>$label</label>\n<input type='radio' name='$nomeVar' value='$valor' {$this->tag}/>";
            }
        }
    }
}
?>
